home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / helpcpp.exe / HELP.DIF < prev    next >
Text File  |  1992-07-13  |  3KB  |  129 lines

  1. 65a66,143
  2. > /**************************************************************************
  3. >                          C L A S S   S T A C K 
  4. > **************************************************************************/
  5. > #define STK_SIZE    10
  6. > #define STK_SHIFT    5
  7. > class Stack
  8. > {
  9. >   int stk[STK_SIZE];
  10. >   int current;
  11. >   int p;
  12. > public:
  13. >   Stack() {}
  14. >   void reset();
  15. >   void save(int v);
  16. >   void push(int v);
  17. >   int pop();
  18. > };
  19. > Stack stack;
  20. > /**************************************************************************
  21. >                        S T A C K : : R E S E T   
  22. > **************************************************************************/
  23. > void Stack::reset()
  24. > {
  25. >     p = 1;
  26. >     stk[0] = 0;
  27. >     current = 0;
  28. > } /* end Stack::Stack */
  29. > /**************************************************************************
  30. >                          S T A C K : : P U S H 
  31. > **************************************************************************/
  32. > void Stack::push(int v)
  33. > {
  34. >   if (p >= STK_SIZE)
  35. >   {
  36. >     // Shift values to the left by STK_SHIFT, saving the first
  37. >     memmove(&stk[1],&stk[1+STK_SHIFT],(STK_SIZE-STK_SHIFT-1)*sizeof(int));
  38. >     p -= STK_SHIFT;
  39. >   }
  40. >   if (p > 0)
  41. >     stk[p++] = current;
  42. >   else if (current != stk[0])
  43. >   {
  44. >     stk[++p] = current;
  45. >     p++;
  46. >   }
  47. >   current = v;
  48. > } /* end Stack::push */
  49. > /**************************************************************************
  50. >                          S T A C K : : S A V E 
  51. > **************************************************************************/
  52. > void Stack::save(int v)
  53. > {
  54. >   current = v;
  55. > } /* end Stack::save */
  56. > /**************************************************************************
  57. >                           S T A C K : : P O P 
  58. > **************************************************************************/
  59. > int Stack::pop()
  60. > {
  61. >   if (p > 0)
  62. >     p--;
  63. >   return stk[p];
  64. > } /* end Stack::pop */
  65. 78a157,158
  66. >     stack.reset();
  67. >     stack.save(context);
  68. 208d287
  69. 218a298
  70. 225a306,311
  71. >         case kbAltF1:
  72. >             keyRef = stack.pop();
  73. >             switchToTopic(keyRef);
  74. >             break;
  75. 229a316
  76. >             stack.push(keyRef);
  77. 232a320
  78. 237a326
  79. 261a351,352
  80. >         {
  81. >         stack.push(keyRef);
  82. 262a354
  83. >         }
  84. 267,271c359,375
  85. <             if ((event.message.command == cmClose) && (owner->state && sfModal != 0))
  86. <                 {
  87. <                 endModal(cmClose);
  88. <                 clearEvent(event);
  89. <                 }
  90. ---
  91. >         switch(event.message.command)
  92. >         {
  93. >         case cmClose:
  94. >         if (owner->state && sfModal != 0)
  95. >             {
  96. >             endModal(cmClose);
  97. >             clearEvent(event);
  98. >             }
  99. >         break;
  100. >         case cmHelp:
  101. >         keyRef = 0;
  102. >         stack.push(keyRef);
  103. >         switchToTopic(keyRef);
  104. >         clearEvent(event);
  105. >         break;
  106. >         }
  107.